package org.jeecg.modules.solitaire_app.app.controller;

import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.solitaire_app.app.entity.VO.ProvinceJyzNumVO;
import org.jeecg.modules.solitaire_app.app.entity.VO.ProvinceVO;
import org.jeecg.modules.solitaire_app.app.entity.YsyDrivers;
import org.jeecg.modules.solitaire_app.app.entity.YsyJyz;
import org.jeecg.modules.solitaire_app.app.service.IYsyDriversService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * @Description: 数据大屏
 * @Author: jeecg-boot
 * @Date: 2023-11-25
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "数据大屏")
@RestController
@RequestMapping("/app/bigData")
public class BigDataController {

    @Autowired
    private IYsyDriversService ysyDriversService;


    @AutoLog(value = "数据大屏-省份列表")
    @ApiOperation(value = "数据大屏-省份列表", notes = "数据大屏-省份列表")
    @GetMapping(value = "/getProvinceList")
    public List<ProvinceVO> getProvinceList() {
        List<ProvinceVO> provinceVOS = new ArrayList<>();
        String provinceStr = "山东、北京、天津、上海、重庆、河北、山西、辽宁、吉林、黑龙江、江苏、浙江、安徽、福建、江西、河南、湖北、湖南、广东、海南、四川、贵州、云南、陕西、甘肃、青海、台湾、内蒙古、广西、西藏、宁夏、新疆、香港、澳门";
        String[] provinceArr = provinceStr.split("、");
        Arrays.stream(provinceArr).forEach(item -> {
            ProvinceVO provinceVO = new ProvinceVO();
            provinceVO.setProvinceName(item);
            provinceVOS.add(provinceVO);
        });
        return provinceVOS;
    }

    @AutoLog(value = "数据大屏-运输车辆")
    @ApiOperation(value = "数据大屏-运输车辆", notes = "数据大屏-运输车辆")
    @PostMapping(value = "/getDrivers")
    public Result<PageInfo<YsyDrivers>> getDrivers(@RequestBody Map<String,Object> map) {
        return ysyDriversService.getYsyDrivers(map);
    }

    @AutoLog(value = "数据大屏-加油站")
    @ApiOperation(value = "数据大屏-加油站", notes = "数据大屏-加油站")
    @PostMapping(value = "/getJyzData")
    public Result<PageInfo<YsyJyz>> getJyzData(@RequestBody Map<String,Object> map) {
        return ysyDriversService.getYsyJyz(map);
    }

    @AutoLog(value = "数据大屏-各省份车辆数量")
    @ApiOperation(value = "数据大屏-各省份车辆数量", notes = "数据大屏-各省份车辆数量")
    @GetMapping(value = "/getProvinceCarNumVO")
    public Result<List<ProvinceJyzNumVO>> getProvinceCarNumVO() {
        return ysyDriversService.getProvinceCarNumVO();
    }

    @AutoLog(value = "数据大屏-各省份加油站数量")
    @ApiOperation(value = "数据大屏-各省份加油站数量", notes = "数据大屏-各省份加油站数量")
    @GetMapping(value = "/getProvinceJyzNumVO")
    public Result<List<ProvinceJyzNumVO>> getProvinceJyzNumVO() {
        return ysyDriversService.getProvinceJyzNumVO();
    }

    @AutoLog(value = "数据大屏-加油站总数量")
    @ApiOperation(value = "数据大屏-加油站总数量", notes = "数据大屏-加油站总数量")
    @GetMapping(value = "/getJyzNum")
    public Result<Integer> getJyzNum() {
        return ysyDriversService.getJyzNum();
    }

    @AutoLog(value = "数据大屏-车辆总数量")
    @ApiOperation(value = "数据大屏-车辆总数量", notes = "数据大屏-车辆总数量")
    @GetMapping(value = "/getCarNum")
    public Result<Integer> getCarNum() {
        return ysyDriversService.getCarNum();
    }
}
